EXTRA_DIST = \
.project \
.settings \
- autogen.sh
+ autogen.sh \
+ tools/check-for-missing.py
# These are files checked into Git that we don't want to distribute
DIST_EXCLUDE = \
distcheck-hook:
@echo "Checking disted files against files in git"
- @failed=false; \
- exclude=`(for p in $(DIST_EXCLUDE) ; do echo --exclude=$$p ; done)`; \
- for f in `cd $(srcdir) && git ls-files $$exclude` ; do \
- if ! test -e $(distdir)/$$f ; then \
- echo File missing from distribution: $$f ; \
- failed=true ; \
- fi \
- done ; \
- if $$failed ; then \
- exit 1 ; \
- fi
+ @$(srcdir)/tools/check-for-missing.py $(srcdir) $(distdir) $(DIST_EXCLUDE)
--- /dev/null
+#!/usr/bin/python
+#
+# This is a simple script that we use to check for files in git
+# and not in the distribution. It was previously written in shell
+# and inlined in the Makefile.am, but 'git ls-files --exclude=<pattern>'
+# was changed to no longer due anything useful, which made that
+# too challenging to be worthwhile.
+
+import fnmatch, os, subprocess, sys
+
+srcdir=sys.argv[1]
+distdir=sys.argv[2]
+excludes=sys.argv[3:]
+
+os.chdir(srcdir)
+
+status=0
+for f in subprocess.Popen(["git", "ls-files"], stdout=subprocess.PIPE).stdout:
+ f = f.strip()
+ if (not os.path.exists(os.path.join(distdir, f)) and
+ not any((fnmatch.fnmatch(f, p) for p in excludes))):
+ print "File missing from distribution:", f
+ status=1
+
+sys.exit(status)